*=================================================================================
* Iris Arbogast (irisarbogast@gmail.com)
* 5/1/2024
* Order of do-files to create final sample of data and results.
* These programs were run on Stata 17, they should work on earlier versions except for the eventdd commands for the event studies

*=================================================================================
*Authors: Iris Arbogast, Anna Chorniy and Janet Currie
*Title: Administrative Burdens and Child Medicaid and CHIP Enrollments
*Journal: American Journal of Health Economics
*Year: 2024
*=================================================================================
*=================================================================================


* install packages
ssc install estout //estout exports regression tables to excel
ssc install eventdd //eventdd runs event studies 


*****************
* Data Cleaning
*****************

* Assume starting in Programs directory, go to main directory
cd ..


/* This program imports and cleans data for the policy regressions including: 
- Medicaid.gov enrollment data[]=7
- the controls created in GetandCleanControls from R
- the policy changes and dates from the novel dataset we create
- population data from the ACS
- premium, income eligibility and redetermination pause data from KFF Annual Surveys
*/

do "Programs/CleanPolicyDataandCMS.do"



/* This program gets the ACS data ready for regressions. It links children with parents and creates dummies for different demographic 
information. It drops a few subgroups (i.e. children with NA for family income), combines the data with the policy data and labels everything. 
*/
do "Programs/CleanACS.do" 


*****************
* Regressions and Figures
*****************


/* This program runs regressions with the policy changes and CMS data and runs event 
studies at the bottom of the file */
do "Programs/RegressionsCMS.do"


/* This program runs regressions for ACS data and checks the correlation between CMS and ACS at the bottom*/
do "Programs/RegressionsACS.do"



/* This program creates graphs of each state for the CMS data, runs the Callaway Sant'Anna specification, and creates the summary table for ACS demographic data. It needs to be run separately in R */
* CreateSummTables.R
